package net.xumf.support.enums;

import lombok.Getter;
import net.xumf.support.exception.NotFoundEnumInfoException;

import java.util.Arrays;

@Getter
public enum IssueLinkType {

    RELATES_TO(1),
    IS_BOKCKED_BY(2),
    BOKCKED(3)
    ;

    private int code;

    IssueLinkType(int code) {
        this.code = code;
    }

    public static IssueLinkType getByCode(int code) {

        return Arrays.stream(values()).filter(o -> o.code == code).findAny()
                .orElseThrow(() -> new NotFoundEnumInfoException(CodeEnum.ENUM_NOT_FOUND_ERROR));
    }
}
